import axios from "axios";

// 获取用户列表
export const reqGetUsersList = (page, limit) => {
  return axios({
    method: "GET",
    url: `/api/users/${page}/${limit}`,
  });
};

// 添加用户
export const reqAddUser = (user) => {
  return axios({
    method: "POST",
    url: `/api/users`,
    data: user,
  });
};

// 更新用户
export const reqUpdateUser = (user) => {
  return axios({
    method: "PUT",
    url: `/api/users/${user.id}`,
    data: {
      username: user.username,
      nickname: user.nickname,
      password: user.password,
    },
  });
};

// 删除用户
export const reqDelUser = (id) => {
  return axios({
    method: "DELETE",
    url: `/api/users/${id}`,
  });
};
